<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我的书架</title>
    <link rel="stylesheet" type="text/css" href="CSS/all.css"  th:href="@{/CSS/all.css}"/>
    <link rel="stylesheet" type="text/css" href="CSS/sj.css"  th:href="@{/CSS/sj.css}"/>
    <script th:src="@{/JS/jquery.js}"></script>
  
</head>
<body>
        <header>
            <div style="position: absolute;padding: 0 10px;height: 28px;margin: 0px 10px;line-height: 28px;font-size: 14px;background-color: #65bbec;border-radius: 3px;width: 30px;    top: calc((100% - 28px) / 2);">
                <a onclick="goback()" style="color: #fff;">返回</a>
            </div>
                书架
            <div style="    color: #fff;position: absolute;padding: 0 10px;width: 30px;height: 28px;margin: 0px 10px;line-height: 28px;text-align: center;border-radius: 3px;right: 0;top: 0;font-size: 14px;background-color: #65bbec;    top: calc((100% - 28px) / 2);">
                <a th:href="@{/Story/getAllCategoryStoryList(isLogin='')}" style="color: #fff;">首页</a>
            </div>
        </header>
        <main>
            <h3>我的书架-会员中心</h3>
            <div class="searchinput">
                <input class="searchBook" type="text"  placeholder="请输入书名或作者" />
                <button  class="search"><svg class="icon" style="width: 1.5rem; height: 1.5rem;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1128"><path d="M963.80969 874.914509 746.640896 653.056614c-3.587891-3.66551-7.710925-6.443725-12.110336-8.352256 46.655488-62.60183 74.359501-140.751667 74.359501-225.526477 0-205.788877-163.237376-372.568371-364.609741-372.568371C242.909082 46.60951 79.67785 213.390029 79.67785 419.177984c0 205.792973 163.231232 372.569395 364.603597 372.569395 92.421632 0 176.807936-35.134157 241.069056-93.044122 1.778586 3.55799 4.115866 6.89705 7.027302 9.871872l217.115546 221.85687c14.970573 15.300506 39.292518 15.300506 54.316237 0C978.780262 915.131494 978.780262 890.21399 963.80969 874.914509zM444.281446 732.950221c-169.564672 0-307.06176-140.4928-307.06176-313.772237 0-173.332685 137.496064-313.766195 307.06176-313.766195 169.570816 0 307.06176 140.433408 307.06176 313.766195C751.343206 592.457421 613.851238 732.950221 444.281446 732.950221z" p-id="1129"></path></svg></button>
            </div>
            <div class="mysj">
                <label th:if="${StoreList['StoreList'].size()<=0}" th:text="暂无数据" style="line-height: 3rem;display: block;text-align: center; "></label>
                <div class="card" th:each="store : ${StoreList['StoreList']}" >
                    <button><a th:data-value="${store.id}" onclick="deleteStore(this)">删除</a></button>
                    <img th:src="@{${store.imgUrl}}" alt="" th:data-value="${store.bookId}" onclick="goBook(this)">
                    <div class="bookinfo">
                        <a class="h2" th:href="@{/Chapter/getChapterByBookId(bookId=${store.bookId})}"  th:text="${store.StoryName}"></a>
                        <p>作者:<span class="author" th:text="${store.bookAuthor}"></span></p>
                        <p>更新到: <a th:href="@{/Story/loadReadBook(chapterId=${store.newChapterId},bookId=${store.bookId})}" style="color: red" th:text="${store.NewChapter}"></a> </p>
                        <p>已读到: <a th:href="@{/Story/loadReadBook(chapterId=${store.chapterId},bookId=${store.bookId})}" th:text="${store.StoreName}"></a> </p>
                    </div>
                </div>
            </div>
        </main>
        <footer>
                本站所有小说为转载作品，所有章节均由网友上传，转载至本站只是为了宣传本书让更多读者欣赏。
        </footer>
</body>
<script th:inline="javascript">
    //搜索条件
    var searchName = [[${StoreList['nameOrAuthor']}]];
    if (searchName != "" && searchName != null && searchName != undefined) {
        $(".searchBook").val(searchName);
    }
    $('div.card').click(function(){
        $('div.card').removeClass('activecard');
        $(this).addClass('activecard');
    })
    function goback(){
        history.back(-1);
    }

    function  out() {
        location.href='/admin/logOut';
    }
    
    //删除收藏
    function deleteStore(that) {
        console.log(that.dataset.value);
        if(confirm('确认删除书签吗? 删除后无法恢复!')==false){
            return false;
        }else{
            location.href='/Store/remove?storeId='+that.dataset.value;
        }
    }
    //进入小说
    function goBook(that){
        location.href='/Chapter/getChapterByBookId?bookId='+that.dataset.value;
    }


    //搜索书签
    $('button.search').click(function(){
        var nameOrAuthor = $(".searchBook").val();
        console.log(nameOrAuthor);
        location.href='/Store/getStoreList?nameOrAuthor='+nameOrAuthor;
    })

</script>

</html>
